import React, { Component, PropTypes } from 'react';
import { connect } from 'dva';
import { message, Modal, Pagination, Popconfirm, Button, Row, Col } from 'antd';
import styles from './Users.css';
import moment from 'moment';
import Factory from '../factory';
import * as datetime from '../../utils/datetime'
import dataEditCreate from '../addons/DataEdit'
import dataTableCreate from '../addons/DataTable'
import DataEditTable from '../addons/DataEditTable'
import Dgckrd_fhqk from './Dgckrd_fhqk'
import * as common from '../../utils/common';
import * as compDiviService from '../../services/AccountDivi';
const daoName = "DGCK_RD";
const ButtonGroup = Button.Group;
const columns = [
  { title: '默认关联', width: 80, key: 'ISMR', dispaly: true, render: data => data.ISMR ? '是' : '否' },
  { title: '账号', width: 210, sorter: true, dataIndex: 'ZH', key: 'ZH', dispaly: true, filter: true },
  { title: '子账号', width: 100, sorter: true, dataIndex: 'BANO', key: 'BANO', dispaly: true, filter: true },
  { title: '开户网点', width: 150, sorter: true, dataIndex: 'KHWD', key: 'KHWD', dispaly: true, filter: true },
  { title: '币种', width: 100, sorter: true, dataIndex: 'BZ', key: 'BZ', dispaly: true, filter: true },
  { title: '科目', width: 200, sorter: true, dataIndex: 'KM', key: 'KM', dispaly: true, filter: true },
  { title: '客户名称', width: 300, sorter: true, dataIndex: 'KHMC', key: 'KHMC', dispaly: true, filter: true },
  { title: '开户日期', width: 150, sorter: true, key: 'KHRQ', render: data => datetime.format(data.KHRQ, "yyyy-MM-dd"), dispaly: true, filter: true },
  { title: '起息日', width: 100, sorter: true, key: 'QXR', render: data => datetime.format(data.QXR, "yyyy-MM-dd"), dispaly: true, filter: true },
  { title: '到期日', width: 100, sorter: true, key: 'DQR', render: data => datetime.format(data.DQR, "yyyy-MM-dd"), dispaly: true, filter: true },
  { title: '存期', width: 100, sorter: true, dataIndex: 'CQ', key: 'CQ', dispaly: true, filter: true },
  { title: '利率', width: 100, sorter: true, dataIndex: 'LL', key: 'LL', dispaly: true, filter: true },
  { title: '结息方式', width: 120, sorter: true, dataIndex: 'JXFS', key: 'JXFS', dispaly: true, filter: true },
  { title: '帐户性质', width: 120, sorter: true, dataIndex: 'ZHXZ', key: 'ZHXZ', dispaly: true, filter: true },
  { title: '帐户状态', width: 120, sorter: true, dataIndex: 'ZHZT', key: 'ZHZT', dispaly: true, filter: true },
  { title: '销户日', width: 100, sorter: true, key: 'XHR', render: data => datetime.format(data.XHR, "yyyy-MM-dd"), dispaly: true, filter: true },
  { title: '当前余额', className: 'column-money', width: 150, sorter: true, render: data => common.formatNumber(data), dataIndex: 'DQYE', key: 'DQYE', dispaly: true, filter: true },
  { title: '上日余额', className: 'column-money', width: 150, sorter: true, render: data => common.formatNumber(data), dataIndex: 'SRYE', key: 'SRYE', dispaly: true, filter: true },
  { title: '开户日均', className: 'column-money', width: 150, sorter: true, render: data => common.formatNumber(data), dataIndex: 'KHRJ', key: 'KHRJ', dispaly: true, filter: true },
  { title: '月日均', className: 'column-money', width: 150, sorter: true, render: data => common.formatNumber(data), dataIndex: 'YRJ', key: 'YRJ', dispaly: true, filter: true },
  { title: '季日均', className: 'column-money', width: 150, sorter: true, render: data => common.formatNumber(data), dataIndex: 'JRJ', key: 'JRJ', dispaly: true, filter: true },
  { title: '年日均', className: 'column-money', width: 150, sorter: true, render: data => common.formatNumber(data), dataIndex: 'NRJ', key: 'NRJ', dispaly: true, filter: true },
  { title: '是否认定', width: 120, sorter: true, key: 'ISDIVI', dispaly: true, render: data => data.ISDIVI ? '已分户' : '未分户' },
];
const columnsWaitDivi = [
  { title: '账号', width: 210, dataIndex: 'ZH', key: 'ZH', dispaly: true },
  { title: '子账号', width: 100, dataIndex: 'BANO', key: 'BANO', dispaly: true },
  { title: '客户名称', width: 200, dataIndex: 'KHMC', key: 'KHMC', dispaly: true }
];
const columnsDivi = [
  { title: '员工ID', dataIndex: 'EMID', key: 'EMID', width: 80, dispaly: false },
  { title: '员工编号', dataIndex: 'EMNO', key: 'EMNO', width: 80, dispaly: true },
  { title: '员工名称', width: 80, sorter: true, dataIndex: 'SysUserName', key: 'SysUserName', dispaly: true },
  { title: '所属机构  ', width: 80, sorter: true, dataIndex: 'OrganName', key: 'OrganName', dispaly: true },
  { title: '分户日期', width: 80, sorter: true, key: 'DSDT', caption: "DSDT", render: data => datetime.format(data.DSDT, "yyyy-MM-dd"), dispaly: true },
  { title: '分成比例', width: 80, sorter: true, dataIndex: 'DSVL', key: 'DSVL', dispaly: true },
];
const controls = [
  { name: 'ZH', required: true, type: 'text', label: '帐号', grid: 12 / 24 },
  { name: 'BANO', required: true, type: 'text', label: '子帐号', grid: 12 / 24 },
  { name: 'KHWD', required: true, type: 'text', label: '开户网点', grid: 12 / 24 },
  { name: 'BZ', required: true, type: 'text', label: '币种', grid: 12 / 24 },
  { name: "KM", label: "科目", grid: 12 / 24, type: "text" },
  { name: 'KHMC', required: true, type: 'text', label: '客户名称', grid: 12 / 24 },
  { name: 'KHRQ', required: true, type: 'date', label: '开户日期', grid: 12 / 24, dataType: "date" },
  { name: "QXR", label: "起息日", type: 'date', grid: 12 / 24, dataType: "date" },
  { name: 'DQR', required: true, type: 'date', label: '到期日', grid: 12 / 24, dataType: "date" },
  { name: 'CQ', required: true, type: 'text', label: '存期', grid: 12 / 24 },
  { name: "LL", label: "利率", type: 'number', grid: 12 / 24, dataType: "number" },
  { name: 'JXFS', required: true, type: 'text', label: '结息方式', grid: 12 / 24 },
  { name: 'ZHXZ', required: true, type: 'text', label: '帐户性质', grid: 12 / 24 },
  { name: "ZHZT", label: "帐户状态", grid: 12 / 24, type: "text" },
  { name: 'XHR', required: true, type: 'date', label: '销户日', grid: 12 / 24, dataType: "date" },
  { name: 'DQYE', required: true, type: 'number', label: '当前余额', grid: 12 / 24, dataType: "number" },
  { name: "SRYE", label: "上日余额", type: 'number', grid: 12 / 24, dataType: "number" },
  { name: 'KHRJ', required: true, type: 'number', label: '开户日均', grid: 12 / 24, dataType: "number" },
  { name: 'YRJ', required: true, type: 'number', label: '月日均', grid: 12 / 24, dataType: "number" },
  { name: "JRJ", label: "季日均", type: 'number', grid: 12 / 24, dataType: "number" },
  { name: 'NRJ', required: true, type: 'number', label: '年日均', grid: 12 / 24 },
];
const controlsWaitDivi = [
  { name: 'ZH', required: true, type: 'text', label: '帐号', grid: 12 / 24 },
  { name: 'BANO', required: true, type: 'text', label: '子账号', grid: 12 / 24 },
  { name: 'KHMC', required: true, type: 'text', label: '客户名称', grid: 12 / 24 }
];
const controlsDivi = [
  { name: 'EMID', required: true, type: 'number', label: '员工编号', grid: 12 / 24, dataType: "number" },
  { name: 'EMNO', required: true, type: 'alphanum', label: '员工编号', grid: 12 / 24 },
  { name: 'SysUserName', required: true, type: 'text', label: '员工名称', grid: 12 / 24 },
  { name: 'OrganName', required: true, type: 'text', label: '所属机构', grid: 12 / 24 },
  { name: "DSDT", required: true, type: "date", label: "分户日期", grid: 12 / 24, dataType: "date" },
  { name: "DSVL", required: true, type: "number", label: '分成比例', grid: 12 / 24, dataType: "number" },
];
const EditFrom = dataEditCreate(daoName);
const DataTable = dataTableCreate(daoName);
class Dgckrd extends Component {
  constructor(props) {
    super(props);
    this.state = {
      dataChange: false,
      diviList: [],
      diviDisplay: {
        div1: 'block',
        div2: 'none',
        lable: '认定',
        isRD: true,
        isDivi: false
      },
      searchData: {},
      diviDataSource: [],
      ISKH: "0"
    };
  }
  componentWillReceiveProps(nextProps) {
  };
  onSelectChangeHandler(newList, delKeys) {
    let diviList = this.state.diviList
    newList.map(data => {
      diviList.push(data)
    })
    delKeys.map(key => {
      const index = diviList.findIndex(divi => divi["ID"] === key)
      diviList.splice(index, 1)
    })
    this.setState({ diviList })
  }
  componentDidMount() {
    this.props.dispatch({
      type: `${daoName}/setKeyName`,
      payload: { keyName: "ID", permID: this.props.permID }
    });
    let whereItems = [];
    let WhereCauses = [];
    // whereItems.push({
    //   FieldName: "FPNO",
    //   Operator: "in",
    //   FieldValues: '1,2,81,82,83,86'
    // })
    whereItems.push({
      FieldName: "1",
      Operator: "<>",
      FieldValues: '1'
    })
    WhereCauses.push({
      WhereItems: whereItems,
      RelationSign: "AND"
    })
    let seeks = WhereCauses
    this.props.dispatch({
      type: `${daoName}/fetch`,
      payload: { daoName, page: 1, pageSize: 20, seeks }
    });
    this.loadOptionData();
  }
  loadOptionData() {
    let options = []
    controls.map(c => {
      if (c.fetch) {
        let f = c.fetch;
        if (c.type === 'cascader-select') {
          f.isCascader = true;
        }
        if (c.type !== 'search') {
          options.push(f);
        }
      }
    })
    if (daoName && options.length > 0) {
      this.props.dispatch({ type: `${daoName}/fetchOptions`, payload: { options } });
    }
  }
  findData() {
    let selectValues = '';
    let zh = '';
    let khmc = '';
    const form = this.refs.findForm.getForm();
    form.validateFields((err, values) => {
      if (!err) {
        if (values.ZH === undefined) {
          values.ZH = ""
        }
        if (values.KHMC === undefined) {
          values.KHMC = ""
        }
        selectValues = values.ISDIVI;
        zh = values.ZH;
        khmc = values.KHMC
      }
    });
    if (selectValues === 'all') {
      selectValues = '0,1'
    }
    let seeks = [];
    let whereItems = [];
    let WhereCauses = [];
    if (zh !== '' && khmc === '') {
      whereItems.push({
        FieldName: "ZH",
        Operator: "like",
        FieldValues: zh
      });
    } else if (zh === '' && khmc !== '') {
      whereItems.push({
        FieldName: "KHMC",
        Operator: "like",
        FieldValues: khmc
      });
    } else {
      whereItems.push({
        FieldName: "ZH",
        Operator: "like",
        FieldValues: zh
      });
      whereItems.push({
        FieldName: "KHMC",
        Operator: "like",
        FieldValues: khmc
      });
    }
    whereItems.push({
      FieldName: "ISDIVI",
      Operator: "in",
      FieldValues: selectValues
    }, {
      FieldName: "TJLX",
      Operator: "in",
      FieldValues: "1,4"
    })

    WhereCauses.push({
      WhereItems: whereItems,
      RelationSign: "AND"
    })
    seeks = WhereCauses;
    this.state.diviDisplay.div1 = 'block';
    this.state.diviDisplay.div2 = 'none';
    this.state.diviDisplay.lable = '认定';
    this.state.diviDisplay.isRD = true;
    this.state.diviDisplay.isDivi = false;
    this.props.dispatch({
      type: `${daoName}/fetch`,
      payload: { daoName, seeks }
    });
  };
  dispalyDivi() {
    if (this.state.diviDisplay.isRD) {
      this.state.diviDisplay.div1 = 'none';
      this.state.diviDisplay.div2 = 'block';
      this.state.diviDisplay.lable = '返回';
      this.state.diviDisplay.isRD = false;
      //this.state.diviDisplay.isDivi = true;
      this.state.diviList = [];
      // const form = this.refs.diviForm.getForm();
      // form.resetFields();
      // this.props.dispatch({
      //   type: `${daoName}/setSelectedRowKeys`,
      //   payload: { selectedRowKeys: [] }
      // });
    } else {
      this.state.diviDisplay.div1 = 'block';
      this.state.diviDisplay.div2 = 'none';
      this.state.diviDisplay.lable = '认定';
      this.state.diviDisplay.isRD = true;
      //this.state.diviDisplay.isDivi = false;
      this.state.diviList = [];
      // const form = this.refs.diviForm.getForm();
      // form.resetFields();
      // this.props.dispatch({
      //   type: `${daoName}/setSelectedRowKeys`,
      //   payload: { selectedRowKeys: [] }
      // });
    }
    this.setState({})
  };
  searchHandle(data) {
    this.state.searchData = data
  };
  diviAdd() {
    let data = {}
    let formatDate = null
    const form = this.refs.diviForm.getForm();
    let isOK = true;
    form.validateFields((err, values) => {
      if (!err) {
        if (values.ZB === undefined || values.ZB === '') {
          message.info('占比不能为空！');
          isOK = false;
        }
        if (values.YG === undefined || values.YG === '') {
          message.info('员工不能为空！');
          isOK = false;
        }
        if (values.YF === undefined) {
          message.info('月份不能为空！');
          isOK = false;
        }
        if (values.ZB === undefined) {
          values.ZB = '';
        }
        if (values.YF === undefined) {
          values.YF = '';
        }
        // if (values.YF !== '') {
        //   formatDate = new Date(values.YF.get('year'), values.YF.get('month'), values.YF.get('day'))
        // }
        // console.log(values.YF.get('year'), values.YF.get('month'), values.YF.get('day'))
        data.DSVL = Number(values.ZB);
        data.DSDT = values.YF
      }
    });
    if (!isOK) {
      return;
    }
    if (this.state.searchData.ID < 0 || this.state.searchData.No.indexOf(":") > 0) {
      message.error('分配失败！员工：' + this.state.searchData.Name + '为虚拟员工，不支持业绩分配！请重新选择')
      return;
    }
    data.EMID = this.state.searchData.ID;                    //员工ID
    data.EMNO = this.state.searchData.No;                    //员工编号
    data.SysUserName = this.state.searchData.Name;           //员工名称
    data.OrganName = this.state.searchData.Organization.Name;//开户机构      
    let diviDs = this.state.diviDataSource
    //验证：添加的员工是否重复，并累加已分配比例是否超出100%
    for (let i = 0; i < diviDs.length; i++) {
      if (Number(diviDs[i]["EMID"]) === Number(data["EMID"])) {
        message.error('分配失败！所选员工已分配，请重新选择员工分配！');
        return;
      }
    }
    let diviSum = data.DSVL;
    diviDs.map(d => diviSum += d.DSVL)
    if (diviSum > 100) {
      message.info('占比不能大于100！');
      return;
    }
    diviDs.push(data);
    this.setState({ diviDataSource: diviDs });
  };
  diviDel() {
    let keys = this.refs.table3.getSelectedRowKeys();
    keys.sort();
    const datas = this.refs.table3.state.datas;
    let indexs = [];
    const keyName = 'EMID'
    datas.map((d, k) => {
      for (let i = 0; i < keys.length; i++) {
        if (d[keyName] === keys[i]) {
          indexs.push(k)
        }
      }
    })
    let diviDsource = this.state.diviDataSource;
    for (let j = indexs.length - 1; j >= 0; j--) {
      const k = indexs[j]
      diviDsource.splice(k, 1)
    }
    this.setState({ diviDataSource: diviDsource })
  };
  diviSubmit() {
    const datas = this.refs.table3.state.datas;
    let len = this.props.selectedRowKeys.length;
    if (len <= 0) {
      message.info('请选择要认定的账户!');
      return;
    }
    let iskh = this.state.ISKH;
    let acid = this.props.selectedRowKeys;
    let dsvlSum = 0;
    let dataSource = []
    datas.map(d => {
      dsvlSum = dsvlSum + d.DSVL;
      let data = {
        EMID: Number(d.EMID),
        DSDT: d.DSDT,
        DSVL: Number(d.DSVL) / 100
      }
      dataSource.push(data);
    })
    if (dsvlSum !== 100) {
      message.info('占比必须为100%');
      return;
    }
    if (iskh === "0") {
      Modal.confirm({
        title: '提示',
        content: `你确认要按账户认定给 【${datas.map(d => d.SysUserName + '(' + d.EMNO + ')')}】 吗？`,
        okText: '确定',
        cancelText: '取消',
        onOk: () => {
          compDiviService.compDivi({ acid, dataSource }
          ).then(function (data) {
            if (data === 'OK') {
              this.state.diviList = []
              this.state.diviDataSource = []
              this.state.ISKH = "0"
              const form = this.refs.diviForm.getForm();
              form.resetFields();
              message.success('数据认定成功！')
            } else {
              message.error('数据认定失败！' + data)
              return;
            }
          }.bind(this)).catch(function (ex) {
            console.log('请求出错', ex)
          });
        }
      });
    } else {
      Modal.confirm({
        title: '提示',
        content: `你确认要按客户认定给【 ${datas.map(d => d.SysUserName + '(' + d.EMNO + ')')}】 吗？`,
        okText: '确定',
        cancelText: '取消',
        onOk: () => {
          compDiviService.compDiviKh({ acid, dataSource }
          ).then(function (data) {
            if (data === 'OK') {
              this.state.diviList = []
              this.state.diviDataSource = []
              this.state.ISKH = "0"
              const form = this.refs.diviForm.getForm();
              form.resetFields();
              message.success('数据认定成功！')
            } else {
              message.error('数据认定失败！' + data)
              return;
            }
          }.bind(this)).catch(function (ex) {
            console.log('请求出错', ex)
          });
        }
      });
    }
  };
  SelDivi(value) {
    let whereItems = [];
    let WhereCauses = [];
    let isdivi = ''
    if (value === 'all') {
      isdivi = '0,1'
    } else {
      isdivi = value
    }
    whereItems.push({
      FieldName: "ISDIVI",
      Operator: "in",
      FieldValues: isdivi
    })
    whereItems.push({
      FieldName: "FPNO",
      Operator: "in",
      FieldValues: '1,2,81,82,83,86'
    })
    WhereCauses.push({
      WhereItems: whereItems,
      RelationSign: "AND"
    })
    let seeks = WhereCauses
    this.props.dispatch({
      type: `${daoName}/fetch`,
      payload: { daoName, page: 1, pageSize: 20, seeks }
    });
  }
  SetIsmrOK() {
    const keys = this.props.selectedRowKeys;
    const len = keys.length;
    if (len === 0) {
      message.info('请选择要设置的数据行！');
      return;
    }
    let acid = keys[0]
    compDiviService.SetIsmrOK({ acid }
    ).then(function (data) {
      if (data === 'OK') {
        this.findData()
        message.success('设置成功！')
      } else {
        message.error('设置失败！' + data)
        return;
      }
    }.bind(this)).catch(function (ex) {
      console.log('请求出错', ex)
    });
  }
  SetIsmrNO() {
    const keys = this.props.selectedRowKeys;
    const len = keys.length;
    if (len === 0) {
      message.info('请选择要设置的数据行！');
      return;
    }
    let acid = keys[0]
    compDiviService.SetIsmrNO({ acid }
    ).then(function (data) {
      if (data === 'OK') {
        this.findData()
        message.success('设置成功！')
      } else {
        message.error('设置失败！' + data)
        return;
      }
    }.bind(this)).catch(function (ex) {
      console.log('请求出错', ex)
    });
  }
  SetISKH(value) {
    if (value === "0") {
      this.setState({ISKH:"0"})
    } else {
      this.setState({ISKH:"1"})
    }
  }
  render() {
    let { showEdit, record, offsetHeight, permID, popedomTypes } = this.props;
    let table1Height = (offsetHeight - 133) * 0.5 - 150
    let data = [{ value: '1', label: '查询', onClick: this.findData.bind(this) }, { value: '2', label: '设置默认关联', onClick: this.SetIsmrOK.bind(this) }, { value: '3', label: '取消默认关联', onClick: this.SetIsmrNO.bind(this) }]
    let pTypes = popedomTypes[permID]
    // if (pTypes.indexOf("6") !== -1) {
    //   data.push({ value: '2', label: this.state.diviDisplay.lable, onClick: this.dispalyDivi.bind(this) })
    // }
    let dataList = this.state.diviList;
    const dsCount = this.state.diviDataSource.length
    const isDisabled = dsCount > 0 ? true : false;

    const controlsFilter = [
      { name: 'ISDIVI', required: false, type: 'select', label: '选择', grid: 3 / 24, data: [{ value: 'all', label: '全部' }, { value: '1', label: '已分户' }, { value: '0', label: '未分户' }], onChange: this.SelDivi.bind(this), layout: { labelSpan: 8, wrapperSpan: 13 } },
      { name: 'ZH', required: false, type: 'text', label: '账号', grid: 7 / 24, layout: { labelSpan: 5, wrapperSpan: 16 }, placeholder: '请输入客户账号...' },
      { name: 'KHMC', required: false, type: 'text', label: '客户名称', grid: 7 / 24, placeholder: '请输入客户姓名...' },
      { name: 'BT', required: false, type: 'button-group', data: data, grid: 7 / 24 },
    ];
    const controlsDivi2 = [
      { name: 'YG', required: false, type: 'search', label: '员工', grid: 5 / 24, layout: { labelSpan: 8, wrapperSpan: 15 }, fetch: { daoName: "UserSel", searchColumns: ['No', 'Name'], optionTpl: 'Name', valueTpl: "ID", onSelect: this.searchHandle.bind(this), permID: permID } },
      { name: 'ZB', required: false, type: 'input-number-min1', label: '占比(%)', grid: 4 / 24, layout: { labelSpan: 10, wrapperSpan: 9 } },
      { name: 'YF', required: false, type: 'date', label: '日期', grid: 6 / 24, isDisabled: isDisabled, layout: { labelSpan: 5, wrapperSpan: 14 } },
      { name: 'BT', required: false, type: 'button-group', data: [{ value: '1', label: '添加', onClick: this.diviAdd.bind(this) }, { value: '2', label: '删除', onClick: this.diviDel.bind(this) }, { value: '3', label: '提交', onClick: this.diviSubmit.bind(this) }], grid: 4 / 24 },
      { name: 'ISKH', required: false, type: 'select', label: '类型', grid: 5 / 24, data: [{ value: '0', label: '按账户' }, { value: '1', label: '按客户' }], onChange: this.SetISKH.bind(this), layout: { labelSpan: 6, wrapperSpan: 9 } },

    ];
    return (
      <div className={styles.normal} style={{ background: '#fff', marginTop: -16, padding: '5px 5px' }}>
        <div>
          <div className={styles.create}>
            <EditFrom ref="findForm" daoName={daoName} controls={controlsFilter} record={{ ISDIVI: 'all' }} selectFirst={false} clearItemMargin={true} />
          </div>
          <DataTable ref="table1" daoName={daoName} columns={columns} controls={controls} height={table1Height} canExport={false} multiSelect={this.state.diviDisplay.isDivi} onSelectChange={this.onSelectChangeHandler.bind(this)} permID={permID} />
          <div style={{ display: this.state.diviDisplay.div1 }}><Dgckrd_fhqk permID={permID} /></div>
          <DataEditTable columns={columnsDivi} ref="table3" height={table1Height}
            dataSource={this.state.diviDataSource} footer={false} keyName={"EMID"} multiSelect={true}
          />
          <EditFrom ref="diviForm" daoName={daoName} controls={controlsDivi2} record={{ ISKH: "0" }} />
        </div>
      </div>
    )
  }
}

function mapStateToProps(state) {
  const { showEdit, record, selectedRowKeys, keyName, list } = state[daoName];
  const { offsetHeight, userID, orgID, pOrgID, popedomTypes } = state.menus
  return {
    userID,
    orgID,
    pOrgID,
    popedomTypes,
    showEdit,
    selectedRowKeys,
    keyName,
    record,
    offsetHeight,
    list
  }
}
Dgckrd = connect(mapStateToProps)(Dgckrd)
export default Dgckrd;

let render = (props) => React.createElement(Dgckrd, props);
let f = new Factory()
f.set("Dgckrd", render)
